package com.cai.servlet.common.user.log;

import com.cai.dao.UserTopicDao;
import com.cai.dao.impl.UserTopicDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * @author RuoLi
 */
@WebServlet(name = "ServletLogUserTopicInfo", value = "/common/log/LogUserTopicInfo")
public class ServletLogUserTopicInfo extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        UserTopicDao userTopicDao=new UserTopicDaoImpl();
        int userAccount=Integer.parseInt(req.getParameter("userAccount"));
        int detailedTopicId=Integer.parseInt(req.getParameter("detailedTopicId"));
        String topicAnswer=req.getParameter("topicAnswer");
        String userAnswer=req.getParameter("userAnswer");
        int topicStatus=Integer.parseInt(req.getParameter("topicStatus"));
        //记录用户数据
        int count= userTopicDao.updateLogUserTopicData(userAccount,detailedTopicId,topicAnswer,userAnswer,topicStatus);
        resp.getWriter().write(count);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
